home *** CD-ROM | disk | FTP | other *** search
/ Freelog 46 / Freelog046.iso / Alu / Celestia / Win32LoresTex / celestia-lores-win32-1.3.0.exe / {app} / shaders / shadowtex_arb.vp < prev    next >
Text File  |  2003-02-18  |  1KB  |  38 lines

  1. !!ARBvp1.0
  2.  
  3. # Vertex program use for applying shadow textures.  2D texture coordinates
  4. # are generated from vertex coordinates using the s and t texture planes.
  5. # A second texture is used as a mask to keep shadows from showing on the
  6. # wrong side of the object.
  7.  
  8. ATTRIB iPos          = vertex.position;
  9. ATTRIB iTex0         = vertex.texcoord[0];
  10. PARAM  mvp[4]        = { state.matrix.mvp };
  11. PARAM  lightDir      = program.env[0];
  12. PARAM  texgen_s      = program.env[10];
  13. PARAM  texgen_t      = program.env[11];
  14. PARAM  halfW         = { 0, 0, 0, 0.5 };
  15. OUTPUT oPos          = result.position;
  16. OUTPUT oTex0         = result.texcoord[0];
  17. OUTPUT oTex1         = result.texcoord[1];
  18.  
  19. TEMP   t;
  20.  
  21. # Transform the vertex by the modelview matrix
  22. DP4   oPos.x, mvp[0], iPos;
  23. DP4   oPos.y, mvp[1], iPos;
  24. DP4   oPos.z, mvp[2], iPos;
  25. DP4   oPos.w, mvp[3], iPos;
  26.  
  27. # Generate texture coordinates
  28. DP4   oTex0.x, texgen_s, iPos;
  29. DP4   oTex0.y, texgen_t, iPos;
  30.  
  31. # Generate 1D coordinates for the 'mask' texture
  32. ADD   t, lightDir, halfW;
  33. DP4   oTex1.x, t, iPos;
  34. MOV   oTex1.y, halfW.x;
  35.  
  36. END
  37.  
  38.